package org.come.Jpanel;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import org.come.Frame.RoleToggleJframe;
import org.come.bean.LoginResult;
import org.come.bean.RoleAttribute;
import org.come.mouslisten.PointChangeOneMouslisten;
import org.come.mouslisten.PointChangeTwoMouslisten;
import org.come.until.AnalysisString;
import org.come.until.FormsManagement;
import org.come.until.JmSum;
import org.soaring.btn.CharacterBtn;

import com.tool.PanelDisplay.RolePanelShow;
import com.tool.btn.FormsOnOffBtn;
import com.tool.btn.JpanelOnJalbelBtn;
import com.tool.role.RoleData;
import com.tool.role.RoleProperty;
import com.tool.tcpimg.UIUtils;
import com.updateNew.MyIsif;

 

/**
 * 人物状态窗口类
 * 
 * @author Administrator
 * 
 */

public class RoleToggleJpanel extends JPanel implements MouseListener {

    private final long serialVersionUID = 1L;
    private int expsize;// 放置飞升经验条的长度
    private JLabel label;
    private int level; // 等级
    private JLabel explain,//说明
    state1,state2,//使用状态
    labrolename1,labrolename2,//属性名
            labrootbone1// 根骨输入框
            , labintelligence1// 灵性输入框
            , labpower1// 力量输入框
            , labspeed1// 敏捷输入框
            , labability1 // 定力输入框
            , labpointnumber1;// 可分配点数输入框
    private JLabel labrootbone2// 根骨输入框
		    , labintelligence2// 灵性输入框
		    , labpower2// 力量输入框
		    , labspeed2// 敏捷输入框
		    , labability2 // 定力输入框
		    , labpointnumber2;// 可分配点数输入框
    private JpanelOnJalbelBtn btnsure1, btnsure2,// 确认加点按钮
    switchbtn1,switchbtn2,//转换按钮
    resetbtn1,resetbtn2//重置
    ;
            

    private CharacterBtn nameBtn // 姓名按钮
            ,
            idBtn // id按钮
            , labappellationBtn // 称谓按钮
            , attributeBtn // 切换属性按钮
            , transformationBtn;// 转换

    private CharacterBtn[] dians1 = new CharacterBtn[10];
    private CharacterBtn[] dians2 = new CharacterBtn[10];

    /**
     * 飞升后人物面板
     * 
     /* @param teststatejframe
     * @throws Exception
     */
    public RoleToggleJpanel(RoleToggleJframe roleToggleJframe) throws Exception {
         //翅膀开关
        String style = MyIsif.getStyle();
        if ("水墨UI".equals(style)) {
    		this.setPreferredSize(new Dimension(350, 311));
            this.setOpaque(false);
            this.setLayout(null);

            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 123);
            offBtn.setBounds(350 - 37, 10, 25, 25);
            this.add(offBtn);

            
            for (int i = 0; i < dians1.length; i++) {
                if (i % 2 == 0) {
                	dians1[i] = new CharacterBtn("skin/8100226/button/12.png", 1, 10 + i);
                } else {
                	dians1[i] = new CharacterBtn("skin/8100226/button/11.png", 1, 10 + i);
                }
                dians1[i].setBounds(133 + i % 2 * 14, 110 + i / 2 * 22, 12, 16);
                dians1[i].addMouseListener(new PointChangeOneMouslisten(i));
                this.add(dians1[i]);
            }
            for (int i = 0; i < dians2.length; i++) {
            	if (i % 2 == 0) {
            		dians2[i] = new CharacterBtn("skin/8100226/button/12.png", 1, 10 + i);
            	} else {
            		dians2[i] = new CharacterBtn("skin/8100226/button/11.png", 1, 10 + i);
            	}
            	dians2[i].setBounds(295 + i % 2 * 14, 110 + i / 2 * 22, 12, 16);
            	dians2[i].addMouseListener(new PointChangeTwoMouslisten(i));
            	this.add(dians2[i]);
            }


            // 根骨
            labrootbone1 = new JLabel();
            labrootbone1.setBounds(66, 89+22, 61, 15);
            labrootbone1.setForeground(Color.WHITE);
            labrootbone1.setFont(new Font("微软雅黑", 1, 12));
            this.add(labrootbone1);

            // 灵性
            labintelligence1 = new JLabel();
            labintelligence1.setBounds(66, 89+22*2, 61, 15);
            labintelligence1.setForeground(Color.WHITE);
            labintelligence1.setFont(new Font("微软雅黑", 1, 12));
            this.add(labintelligence1);

            // 力量
            labpower1 = new JLabel();
            labpower1.setBounds(66, 89+22*3, 61, 15);
            labpower1.setForeground(Color.WHITE);
            labpower1.setFont(new Font("微软雅黑", 1, 12));
            this.add(labpower1);

            // 敏捷
            labspeed1 = new JLabel();
            labspeed1.setBounds(66, 89+22*4, 61, 15);
            labspeed1.setForeground(Color.WHITE);
            labspeed1.setFont(new Font("微软雅黑", 1, 12));
            this.add(labspeed1);

            // 定力
            labability1 = new JLabel("0");
            labability1.setBounds(66, 89+22*5, 61, 15);
            labability1.setForeground(Color.WHITE);
            labability1.setFont(new Font("微软雅黑", 1, 12));
            this.add(labability1);

            // 可分配点数
            labpointnumber1 = new JLabel();
            labpointnumber1.setBounds(101, 89, 41, 15);
            labpointnumber1.setForeground(Color.WHITE);
            labpointnumber1.setFont(new Font("微软雅黑", 1, 12));
            this.add(labpointnumber1);
            
            // 根骨
            labrootbone2 = new JLabel();
            labrootbone2.setBounds(229, 89+22, 61, 15);
            labrootbone2.setForeground(Color.WHITE);
            labrootbone2.setFont(new Font("微软雅黑", 1, 12));
            this.add(labrootbone2);
            
            // 灵性
            labintelligence2 = new JLabel();
            labintelligence2.setBounds(229, 89+22*2, 61, 15);
            labintelligence2.setForeground(Color.WHITE);
            labintelligence2.setFont(new Font("微软雅黑", 1, 12));
            this.add(labintelligence2);
            
            // 力量
            labpower2 = new JLabel();
            labpower2.setBounds(229, 89+22*3, 61, 15);
            labpower2.setForeground(Color.WHITE);
            labpower2.setFont(new Font("微软雅黑", 1, 12));
            this.add(labpower2);
            
            // 敏捷
            labspeed2 = new JLabel();
            labspeed2.setBounds(229, 89+22*4, 61, 15);
            labspeed2.setForeground(Color.WHITE);
            labspeed2.setFont(new Font("微软雅黑", 1, 12));
            this.add(labspeed2);
            
            // 定力
            labability2 = new JLabel("0");
            labability2.setBounds(229, 89+22*5, 61, 15);
            labability2.setForeground(Color.WHITE);
            labability2.setFont(new Font("微软雅黑", 1, 12));
            this.add(labability2);
            
            // 可分配点数
            labpointnumber2 = new JLabel();
            labpointnumber2.setBounds(263, 89, 41, 15);
            labpointnumber2.setForeground(Color.WHITE);
            labpointnumber2.setFont(new Font("微软雅黑", 1, 12));
            this.add(labpointnumber2);

            // 名字
            labrolename1 = new JLabel();
            labrolename1.setBounds(28, 35, 120, 15);
            labrolename1.setForeground(Color.WHITE);
            labrolename1.setFont(new Font("微软雅黑", 1, 12));
            labrolename1.setText("属性一");
            this.add(labrolename1);
            // 名字
            labrolename2 = new JLabel();
            labrolename2.setBounds(191, 35, 120, 15);
            labrolename2.setForeground(Color.WHITE);
            labrolename2.setFont(new Font("微软雅黑", 1, 12));
            labrolename2.setText("属性二");
            this.add(labrolename2);
            
            // 状态
            state1 = new JLabel();
            state1.setBounds(30, 60, 120, 15);
            state1.setForeground(Color.WHITE);
            state1.setFont(new Font("楷体", 1, 14));
            state1.setText("未启用");
            this.add(state1);
            // 状态
            state2 = new JLabel();
            state2.setBounds(193, 60, 120, 15);
            state2.setForeground(Color.WHITE);
            state2.setFont(new Font("楷体", 1, 14));
            state2.setText("未启用");
            this.add(state2);
            // 说明
            explain = new JLabel();
            explain.setBounds(30, 275, 320, 30);
            explain.setForeground(Color.red);
            explain.setFont(new Font("楷体", 1, 14));
            explain.setText("注意:每次切换消耗50W两,重置消耗200W两!");
            this.add(explain);
            
            Font font = new Font("宋体",0, 12);
            // 转换按钮
            switchbtn1 = new JpanelOnJalbelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, 12, "切换", this);
            switchbtn1.setBounds(122, 34, 34, 17);
            switchbtn1.setFont(font);
            this.add(switchbtn1);
            // 转换按钮
            switchbtn2 = new JpanelOnJalbelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, 13, "切换", this);
            switchbtn2.setBounds(285, 34, 34, 17);
            switchbtn2.setFont(font);
            this.add(switchbtn2);
            
            // 重置按钮
            resetbtn1 = new JpanelOnJalbelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, 14, "重置", this);
            resetbtn1.setBounds(43, 250, 34, 17);
            resetbtn1.setFont(font);
            this.add(resetbtn1);
            // 重置按钮
            resetbtn2 = new JpanelOnJalbelBtn("skin/8100226/newbutton/B30.png", 1, UIUtils.COLOR_BTNTEXT, 15, "重置", this);
            resetbtn2.setBounds(205, 250, 34, 17);
            resetbtn2.setFont(font);
            this.add(resetbtn2);

            // 确认加点
            btnsure1 = new JpanelOnJalbelBtn("skin/8100226/newbutton/B32.png", 1, UIUtils.COLOR_BTNTEXT, 11, "确认加点", this);
            btnsure1.setBounds(98, 250, 51, 17);
            btnsure1.setFont(font);
            this.add(btnsure1);
            // 确认加点
            btnsure2 = new JpanelOnJalbelBtn("skin/8100226/newbutton/B32.png", 1, UIUtils.COLOR_BTNTEXT, 11, "确认加点", this);
            btnsure2.setBounds(260, 250, 51, 17);
            btnsure2.setFont(font);
            this.add(btnsure2);
        }else {
            this.setPreferredSize(new Dimension(350, 311));
            this.setOpaque(false);
            this.setLayout(null);

            // 名字
            labrolename1 = new JLabel();
            labrolename1.setBounds(38, 67, 120, 15);
            labrolename1.setForeground(Color.WHITE);
            labrolename1.setFont(new Font("微软雅黑", 1, 14));
            labrolename1.setText("属性一");
            this.add(labrolename1);
            // 名字
            labrolename2 = new JLabel();
            labrolename2.setBounds(193, 67, 120, 15);
            labrolename2.setForeground(Color.WHITE);
            labrolename2.setFont(new Font("微软雅黑", 1, 14));
            labrolename2.setText("属性二");
            this.add(labrolename2);

            // 状态
            state1 = new JLabel();
            state1.setBounds(30, 42, 120, 15);
            state1.setForeground(Color.WHITE);
            state1.setFont(new Font("楷体", 1, 14));
            state1.setText("未启用");
            this.add(state1);
            // 名字
            state2 = new JLabel();
            state2.setBounds(185, 42, 120, 15);
            state2.setForeground(Color.WHITE);
            state2.setFont(new Font("楷体", 1, 14));
            state2.setText("未启用");
            this.add(state2);

            // 说明
//            explain = new JLabel();
//            explain.setBounds(30, 265, 320, 30);
//            explain.setForeground(Color.red);
//            explain.setFont(new Font("楷体", 1, 14));
//            explain.setText("注意:每次切换消耗20W两,重置消耗100W两!");
//            this.add(explain);

            // 关闭按钮事件
            FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/hongmu/s74.png", 1, 123);
            offBtn.setBounds(350-25, 0, 23, 23);
            this.add(offBtn);


            for (int i = 0; i < dians1.length; i++) {
                if (i % 2 == 0) {
                    dians1[i] = new CharacterBtn("img/xy2uiimg/26_png.button.btn_left.png", 1, 10 + i);
                } else {
                    dians1[i] = new CharacterBtn("img/xy2uiimg/54_png.button.btn_right.png", 1, 10 + i);
                }
                dians1[i].setBounds(129 + i % 2 * 13, 118 + i / 2 * 24, 13, 13);
                dians1[i].addMouseListener(new PointChangeOneMouslisten(i));
                this.add(dians1[i]);
            }
            for (int i = 0; i < dians2.length; i++) {
                if (i % 2 == 0) {
                    dians2[i] = new CharacterBtn("img/xy2uiimg/26_png.button.btn_left.png", 1, 10 + i);
                } else {
                    dians2[i] = new CharacterBtn("img/xy2uiimg/54_png.button.btn_right.png", 1, 10 + i);
                }
                dians2[i].setBounds(283 + i % 2 * 13, 118 + i / 2 * 24, 13, 13);
                dians2[i].addMouseListener(new PointChangeTwoMouslisten(i));
                this.add(dians2[i]);
            }
            Font font = new Font("楷体",0, 14);
            //属性一
            // 根骨
            labrootbone1 = new JLabel();
            labrootbone1.setBounds(88, 118, 61, 15);
            labrootbone1.setForeground(Color.WHITE);
            labrootbone1.setFont(font);
            this.add(labrootbone1);

            // 灵性
            labintelligence1 = new JLabel();
            labintelligence1.setBounds(88, 141, 61, 15);
            labintelligence1.setForeground(Color.WHITE);
            labintelligence1.setFont(font);
            this.add(labintelligence1);

            // 力量
            labpower1 = new JLabel();
            labpower1.setBounds(88, 165, 61, 15);
            labpower1.setForeground(Color.WHITE);
            labpower1.setFont(font);
            this.add(labpower1);

            // 敏捷
            labspeed1 = new JLabel();
            labspeed1.setBounds(88, 190, 61, 15);
            labspeed1.setForeground(Color.WHITE);
            labspeed1.setFont(font);
            this.add(labspeed1);

            // 定力
            labability1 = new JLabel("0");
            labability1.setBounds(88, 213, 61, 15);
            labability1.setForeground(Color.WHITE);
            labability1.setFont(font);
            this.add(labability1);

            // 可分配点数
            labpointnumber1 = new JLabel();
            labpointnumber1.setBounds(115, 95, 41, 15);
            labpointnumber1.setForeground(Color.WHITE);
            labpointnumber1.setFont(font);
            this.add(labpointnumber1);


            //属性二
            // 根骨
            labrootbone2 = new JLabel();
            labrootbone2.setBounds(245, 118, 61, 15);
            labrootbone2.setForeground(Color.WHITE);
            labrootbone2.setFont(font);
            this.add(labrootbone2);

            // 灵性
            labintelligence2 = new JLabel();
            labintelligence2.setBounds(245, 141, 61, 15);
            labintelligence2.setForeground(Color.WHITE);
            labintelligence2.setFont(font);
            this.add(labintelligence2);

            // 力量
            labpower2 = new JLabel();
            labpower2.setBounds(245, 165, 61, 15);
            labpower2.setForeground(Color.WHITE);
            labpower2.setFont(font);
            this.add(labpower2);

            // 敏捷
            labspeed2 = new JLabel();
            labspeed2.setBounds(245, 190, 61, 15);
            labspeed2.setForeground(Color.WHITE);
            labspeed2.setFont(font);
            this.add(labspeed2);

            // 定力
            labability2 = new JLabel("0");
            labability2.setBounds(245, 213, 61, 15);
            labability2.setForeground(Color.WHITE);
            labability2.setFont(font);
            this.add(labability2);

            // 可分配点数
            labpointnumber2 = new JLabel();
            labpointnumber2.setBounds(270, 95, 41, 15);
            labpointnumber2.setForeground(Color.WHITE);
            labpointnumber2.setFont(font);
            this.add(labpointnumber2);
            // 确认加点
            btnsure1 = new JpanelOnJalbelBtn("inkImg/hongmu/a20.png", 1, UIUtils.COLOR_BTNTEXT, 11, "", this);
            btnsure1.setBounds(95, 231, 68, 17);
            this.add(btnsure1);
            // 确认加点
            btnsure2 = new JpanelOnJalbelBtn("inkImg/hongmu/a20.png", 1, UIUtils.COLOR_BTNTEXT, 11, "", this);
            btnsure2.setBounds(245, 231, 68, 17);
            this.add(btnsure2);

            font = new Font("宋体",0, 12);
            // 转换按钮
            switchbtn1 = new JpanelOnJalbelBtn("inkImg/hongmu/21_png.button.tab_nex.png", 1, UIUtils.COLOR_BTNPUTONG2, 12, "切换", this);
            switchbtn1.setBounds(120, 41, 34, 17);
            switchbtn1.setFont(font);
            this.add(switchbtn1);
            // 转换按钮
            switchbtn2 = new JpanelOnJalbelBtn("inkImg/hongmu/21_png.button.tab_nex.png", 1, UIUtils.COLOR_BTNPUTONG2, 13, "切换", this);
            switchbtn2.setBounds(275, 41, 34, 17);
            switchbtn2.setFont(font);
            this.add(switchbtn2);

            // 重置按钮
            resetbtn1 = new JpanelOnJalbelBtn("inkImg/hongmu/21_png.button.tab_nex.png", 1, UIUtils.COLOR_BTNPUTONG2, 14, "重置", this);
            resetbtn1.setBounds(45, 231, 34, 17);
            resetbtn1.setFont(font);
            this.add(resetbtn1);
            // 重置按钮
            resetbtn2 = new JpanelOnJalbelBtn("inkImg/hongmu/21_png.button.tab_nex.png", 1, UIUtils.COLOR_BTNPUTONG2, 15, "重置", this);
            resetbtn2.setBounds(200, 231, 34, 17);
            resetbtn2.setFont(font);
            this.add(resetbtn2);
        }
    }

    private ImageIcon icon;

    // private ImageIcon icon2;
    private String style = MyIsif.getStyle();
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        LoginResult loginResult = RoleData.getRoleData().getLoginResult();
        // 判断飞升与否
        level = AnalysisString.lvltrue(loginResult.getGrade());
        // 道具栏
        if(style.equals("水墨UI")) {
    		if(level <= 3) {
    			icon = new ImageIcon("inkImg/newbackground/B280.png");
    			g.drawImage(icon.getImage(), 0, 0, 350, 311, this);
    		}else {
    			icon = new ImageIcon("inkImg/newbackground/B279.png");
    			g.drawImage(icon.getImage(), 0, 0, 350, 311, this);
    		}
        }else {
            if(level <= 3) {
                icon = new ImageIcon("img/xy2uiimg/切属性_w450,h300.png");
                g.drawImage(this.icon.getImage(), 0, 0, 350, 311, this);
            }else {
                icon = new ImageIcon("img/xy2uiimg/切属性_飞升_w450,h300.png");
                g.drawImage(this.icon.getImage(), 0, 0, 350, 311, this);
            }
        }
    } 

    /**
     * 0-4 获取根骨灵性力量敏捷可分配点 属性一
     */
    public int getdian1(int type) {
        try {
            if (type == 0) {
                type = Integer.parseInt(labrootbone1.getText());
            } else if (type == 1) {
                type = Integer.parseInt(labintelligence1.getText());
            } else if (type == 2) {
                type = Integer.parseInt(labpower1.getText());
            } else if (type == 3) {
                type = Integer.parseInt(labspeed1.getText());
            } else if (type == 4) {
                type = Integer.parseInt(labability1.getText());
            } else if (type == 5) {
                type = Integer.parseInt(labpointnumber1.getText());
            }
        } catch (Exception e) {
            // TODO: handle exception
            type = 0;
        }
        return type;
    }
    /**
     * 0-4 获取根骨灵性力量敏捷可分配点 属性二
     */
    public int getdian2(int type) {
    	try {
    		if (type == 0) {
    			type = Integer.parseInt(labrootbone2.getText());
    		} else if (type == 1) {
    			type = Integer.parseInt(labintelligence2.getText());
    		} else if (type == 2) {
    			type = Integer.parseInt(labpower2.getText());
    		} else if (type == 3) {
    			type = Integer.parseInt(labspeed2.getText());
    		} else if (type == 4) {
    			type = Integer.parseInt(labability2.getText());
    		} else if (type == 5) {
    			type = Integer.parseInt(labpointnumber2.getText());
    		}
    	} catch (Exception e) {
    		// TODO: handle exception
    		type = 0;
    	}
    	return type;
    }

    /**
     * 0-4 点数变化根骨灵性力量敏捷可分配点 属性一
     */
    public void adddian1(int type, int point) {
        try {
            if (type == 0) {
                type = Integer.parseInt(labrootbone1.getText());
                labrootbone1.setText(type + point + "");
            } else if (type == 1) {
                type = Integer.parseInt(labintelligence1.getText());
                labintelligence1.setText(type + point + "");
            } else if (type == 2) {
                type = Integer.parseInt(labpower1.getText());
                labpower1.setText(type + point + "");
            } else if (type == 3) {
                type = Integer.parseInt(labspeed1.getText());
                labspeed1.setText(type + point + "");
            } else if (type == 4) {
                type = Integer.parseInt(labability1.getText());
                labability1.setText(type + point + "");
            }
            type = Integer.parseInt(labpointnumber1.getText());
            labpointnumber1.setText(type - point + "");
        } catch (Exception e) {
            // TODO: handle exception
        }
    }
    /**
     * 0-4 点数变化根骨灵性力量敏捷可分配点 属性一
     */
    public void adddian2(int type, int point) {
    	try {
    		if (type == 0) {
    			type = Integer.parseInt(labrootbone2.getText());
    			labrootbone2.setText(type + point + "");
    		} else if (type == 1) {
    			type = Integer.parseInt(labintelligence2.getText());
    			labintelligence2.setText(type + point + "");
    		} else if (type == 2) {
    			type = Integer.parseInt(labpower2.getText());
    			labpower2.setText(type + point + "");
    		} else if (type == 3) {
    			type = Integer.parseInt(labspeed2.getText());
    			labspeed2.setText(type + point + "");
    		} else if (type == 4) {
    			type = Integer.parseInt(labability2.getText());
    			labability2.setText(type + point + "");
    		}
    		type = Integer.parseInt(labpointnumber2.getText());
    		labpointnumber2.setText(type - point + "");
    	} catch (Exception e) {
    		// TODO: handle exception
    	}
    }

    /**
     * 飞升前面板与飞升后面板切换
     * 
     * @param lvltrue
     *            <=3没有飞升 >3飞升
     */
    public void changeSoaringPanel(int lvltrue) {
    	level = lvltrue;
        if (lvltrue <= 3) {// 没有飞升
            // 隐藏飞升后才有的功能
            dians1[8].setVisible(false);
            dians2[8].setVisible(false);
            dians1[9].setVisible(false);
            dians2[9].setVisible(false);
            labability1.setVisible(false);
            labability2.setVisible(false);
        } else {// 飞升
            // 展示飞升才有的功能
            dians1[8].setVisible(true);
            dians2[8].setVisible(true);
            dians1[9].setVisible(true);
            dians2[9].setVisible(true);
            labability1.setVisible(true);
            labability2.setVisible(true);
        }
    }

    @Override
    public void mouseClicked(MouseEvent e) {

    }

    @Override
    public void mousePressed(MouseEvent e) {

    }

    @Override
    public void mouseReleased(MouseEvent e) {
        FormsManagement.HideForm(0);
    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {
        // TODO Auto-generated method stub

    }


    public JLabel getLabel() {
        return label;
    }

    public void setLabel(JLabel label) {
        this.label = label;
    }

    public JLabel getLabrootbone1() {
        return labrootbone1;
    }

    public void setLabrootbone1(JLabel labrootbone1) {
        this.labrootbone1 = labrootbone1;
    }

    public JLabel getLabintelligence1() {
        return labintelligence1;
    }

    public void setLabintelligence1(JLabel labintelligence1) {
        this.labintelligence1 = labintelligence1;
    }

    public JLabel getLabpower1() {
        return labpower1;
    }

    public void setLabpower1(JLabel labpower1) {
        this.labpower1 = labpower1;
    }

    public JLabel getLabspeed1() {
        return labspeed1;
    }

    public void setLabspeed1(JLabel labspeed1) {
        this.labspeed1 = labspeed1;
    }

    public JLabel getLabpointnumber1() {
        return labpointnumber1;
    }

    public void setLabpointnumber1(JLabel labpointnumber1) {
        this.labpointnumber1 = labpointnumber1;
    }

    public int getExpsize() {
        return expsize;
    }

    public void setExpsize(int expsize) {
        this.expsize = expsize;
    }

    public JLabel getLabability1() {
        return labability1;
    }

    public void setLabability1(JLabel labability1) {
        this.labability1 = labability1;
    }

    public JpanelOnJalbelBtn getBtnsure1() {
		return btnsure1;
	}

	public void setBtnsure1(JpanelOnJalbelBtn btnsure1) {
		this.btnsure1 = btnsure1;
	}

	public JpanelOnJalbelBtn getBtnsure2() {
		return btnsure2;
	}

	public void setBtnsure2(JpanelOnJalbelBtn btnsure2) {
		this.btnsure2 = btnsure2;
	}


    public CharacterBtn getNameBtn() {
        return nameBtn;
    }

    public void setNameBtn(CharacterBtn nameBtn) {
        this.nameBtn = nameBtn;
    }

    public CharacterBtn getIdBtn() {
        return idBtn;
    }

    public void setIdBtn(CharacterBtn idBtn) {
        this.idBtn = idBtn;
    }

    public CharacterBtn getLabappellationBtn() {
        return labappellationBtn;
    }

    public void setLabappellationBtn(CharacterBtn labappellationBtn) {
        this.labappellationBtn = labappellationBtn;
    }

    public CharacterBtn getAttributeBtn() {
        return attributeBtn;
    }

    public void setAttributeBtn(CharacterBtn attributeBtn) {
        this.attributeBtn = attributeBtn;
    }

    public CharacterBtn getTransformationBtn() {
        return transformationBtn;
    }

    public void setTransformationBtn(CharacterBtn transformationBtn) {
        this.transformationBtn = transformationBtn;
    }

    public CharacterBtn[] getDians1() {
        return dians1;
    }

    public void setDians1(CharacterBtn[] dians1) {
        this.dians1 = dians1;
    }

    public CharacterBtn[] getDians2() {
		return dians2;
	}

	public void setDians2(CharacterBtn[] dians2) {
		this.dians2 = dians2;
	}

	public ImageIcon getIcon() {
        return icon;
    }

    public void setIcon(ImageIcon icon) {
        this.icon = icon;
    }

    public long getSerialversionuid() {
        return serialVersionUID;
    }

    
    
    public JLabel getLabrootbone2() {
		return labrootbone2;
	}

	public void setLabrootbone2(JLabel labrootbone2) {
		this.labrootbone2 = labrootbone2;
	}

	public JLabel getLabintelligence2() {
		return labintelligence2;
	}

	public void setLabintelligence2(JLabel labintelligence2) {
		this.labintelligence2 = labintelligence2;
	}

	public JLabel getLabpower2() {
		return labpower2;
	}

	public void setLabpower2(JLabel labpower2) {
		this.labpower2 = labpower2;
	}

	public JLabel getLabspeed2() {
		return labspeed2;
	}

	public void setLabspeed2(JLabel labspeed2) {
		this.labspeed2 = labspeed2;
	}

	public JLabel getLabability2() {
		return labability2;
	}

	public void setLabability2(JLabel labability2) {
		this.labability2 = labability2;
	}

	public JLabel getLabpointnumber2() {
		return labpointnumber2;
	}

	public void setLabpointnumber2(JLabel labpointnumber2) {
		this.labpointnumber2 = labpointnumber2;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public JLabel getState1() {
		return state1;
	}

	public void setState1(JLabel state1) {
		this.state1 = state1;
	}

	public JLabel getState2() {
		return state2;
	}

	public void setState2(JLabel state2) {
		this.state2 = state2;
	}

	public JLabel getLabrolename1() {
		return labrolename1;
	}

	public void setLabrolename1(JLabel labrolename1) {
		this.labrolename1 = labrolename1;
	}

	public JLabel getLabrolename2() {
		return labrolename2;
	}

	public void setLabrolename2(JLabel labrolename2) {
		this.labrolename2 = labrolename2;
	}
	/**
     * 人物属性添加增加对应的属性
     *
     * @throws Exception
     */
    public void getplayerValue() {
        LoginResult loginResult = RoleData.getRoleData().getLoginResult();
        if(loginResult.getCurrentattribute()!=null && loginResult.getCurrentattribute()!=0) {
        	if(loginResult.getCurrentattribute()==1) {
        		state1.setForeground(Color.green);
        		state1.setText("当前启用中");
        	}else if(loginResult.getCurrentattribute()==2) {
        		state2.setForeground(Color.green);
        		state2.setText("当前启用中");
        	}
        }
        int lvltrue = AnalysisString.lvltrue(loginResult.getGrade());
        changeSoaringPanel(lvltrue);
        // 设置等级
        RolePanelShow.changeRoleGrade(loginResult.getGrade());
        
        RoleAttribute roleAttribute = RoleData.getRoleData().getRoleAttribute();
		int lvl = AnalysisString.lvlint(loginResult.getGrade());
		if(roleAttribute==null) {
			roleAttribute = new RoleAttribute();
		}
		if(roleAttribute.getBONEONE()==null) {
			roleAttribute.setBONEONE(lvl);
			roleAttribute.setSPIRONE(lvl);
			roleAttribute.setPOWERONE(lvl);
			roleAttribute.setSPEEDONE(lvl);
			if (loginResult.getTurnAround() >= 4) {
				roleAttribute.setCALMONE(lvl);
			}else {
				roleAttribute.setCALMONE(0);
			}
		}
		if(roleAttribute.getBONETWO()==null) {
			roleAttribute.setBONETWO(lvl);
			roleAttribute.setSPIRTWO(lvl);
			roleAttribute.setPOWERTWO(lvl);
			roleAttribute.setSPEEDTWO(lvl);
			if (loginResult.getTurnAround() >= 4) {
				roleAttribute.setCALMTWO(lvl);
			}else {
				roleAttribute.setCALMTWO(0);
			}
		}
		// 可分配点数 属性一
		this.getLabpointnumber1().setText(getCanpoint1(roleAttribute).toString());
		RoleProperty property1 = RoleProperty.property;
		if (property1 == null) {
			return;
		}
        // 根骨输入框
        this.getLabrootbone1().setText(roleAttribute.getBONEONE() + "");
        // 灵性输入框
        this.getLabintelligence1().setText(roleAttribute.getSPIRONE() + "");
        // 力量输入框
        this.getLabpower1().setText(roleAttribute.getPOWERONE() + "");
        // 敏捷输入框
        this.getLabspeed1().setText(roleAttribute.getSPEEDONE() + "");
        // 定力输入框
        this.getLabability1().setText(roleAttribute.getCALMONE() + "");
        
        // 可分配点数 属性二
        this.getLabpointnumber2().setText(getCanpoint2(roleAttribute).toString());
        RoleProperty property2 = RoleProperty.property;
        if (property2 == null) {
        	return;
        }
        // 根骨输入框
        this.getLabrootbone2().setText(roleAttribute.getBONETWO() + "");
        // 灵性输入框
        this.getLabintelligence2().setText(roleAttribute.getSPIRTWO() + "");
        // 力量输入框
        this.getLabpower2().setText(roleAttribute.getPOWERTWO() + "");
        // 敏捷输入框
        this.getLabspeed2().setText(roleAttribute.getSPEEDTWO() + "");
        // 定力输入框
        this.getLabability2().setText(roleAttribute.getCALMTWO() + "");
    }
    
    //可分配点数 属性一
    public static Integer getCanpoint1(RoleAttribute roleAttribute) {
    	LoginResult loginResult = RoleData.getRoleData().getLoginResult();
		int lvl = loginResult.getGrade();
		int Turn = AnalysisString.lvltrue(lvl);
		lvl = AnalysisString.lvlint(lvl);
		int canpoint = lvl * 8;
		canpoint += loginResult.getExtraPointInt();
		if (Turn < 4) {
			canpoint += Turn * 60;
		} else {
			canpoint += 180 + lvl;
		}

		int v = roleAttribute.getBONEONE();
		canpoint -= v;
		if (v < lvl) {
			JmSum.xiugaiqi();
		}

		v = roleAttribute.getSPIRONE();
		canpoint -= v;
		if (v < lvl) {
			JmSum.xiugaiqi();
		}

		v = roleAttribute.getPOWERONE();
		canpoint -= v;
		if (v < lvl) {
			JmSum.xiugaiqi();
		}

		v = roleAttribute.getSPEEDONE();
		canpoint -= v;
		if (v < lvl) {
			JmSum.xiugaiqi();
		}

		v = roleAttribute.getCALMONE();
		canpoint -= v;
		if (v < 0 || Turn >= 4 && v < lvl) {
			JmSum.xiugaiqi();
		}

		if (canpoint < 0) {
			JmSum.xiugaiqi();
		}
		return canpoint;
	}
    //可分配点数 属性一
    public static Integer getCanpoint2(RoleAttribute roleAttribute) {
    	LoginResult loginResult = RoleData.getRoleData().getLoginResult();
    	int lvl = loginResult.getGrade();
    	int Turn = AnalysisString.lvltrue(lvl);
    	lvl = AnalysisString.lvlint(lvl);
    	int canpoint = lvl * 8;
    	canpoint += loginResult.getExtraPointInt();
    	if (Turn < 4) {
    		canpoint += Turn * 60;
    	} else {
    		canpoint += 180 + lvl;
    	}
    	
    	int v = roleAttribute.getBONETWO();
    	canpoint -= v;
    	if (v < lvl) {
    		JmSum.xiugaiqi();
    	}
    	
    	v = roleAttribute.getSPIRTWO();
    	canpoint -= v;
    	if (v < lvl) {
    		JmSum.xiugaiqi();
    	}
    	
    	v = roleAttribute.getPOWERTWO();
    	canpoint -= v;
    	if (v < lvl) {
    		JmSum.xiugaiqi();
    	}
    	
    	v = roleAttribute.getSPEEDTWO();
    	canpoint -= v;
    	if (v < lvl) {
    		JmSum.xiugaiqi();
    	}
    	
    	v = roleAttribute.getCALMTWO();
    	canpoint -= v;
    	if (v < 0 || Turn >= 4 && v < lvl) {
    		JmSum.xiugaiqi();
    	}
    	
    	if (canpoint < 0) {
    		JmSum.xiugaiqi();
    	}
    	return canpoint;
    }
}
